package design.patterns.creational.prototype.v2;

import java.util.Date;

/**
 * @author gjx
 * @version v1.0
 * @Description   原型模式
 * @date 2019/4/1 9:50
 */

//深克隆
public class Test {
    public static void main(String[] args) throws CloneNotSupportedException {
        Computer computer = new Computer();
        Date date = new Date();
        computer.setName("联想拯救者");
        computer.setPrice(5000D);
        computer.setDate(date);

        Computer tmpCompute = (Computer) computer.clone();
        System.out.println(computer);
        System.out.println(tmpCompute);


        date.setTime(1000000000);
        System.out.println(computer);
        System.out.println(tmpCompute);
    }
}
